﻿using SqlSugar;

namespace EasyTemplate.Tool.Entity;

/// <summary>
/// 规格
/// </summary>
[SugarTable(null, "规格")]
[SugarIndex("ProductId", nameof(ProductId), OrderByType.Desc)]
public partial class TProductSku: EntityBase
{
    /// <summary>
    /// 商品Id
    /// </summary>
    [SugarColumn(ColumnDescription = "商品Id", IsNullable = true)]
    public long ProductId { get; set; }
    /// <summary>
    /// 属性id列表
    /// </summary>
    [SugarColumn(ColumnDescription = "属性id列表", IsNullable = true)]
    public string PropertyIds { get; set; }
    /// <summary>
    /// 规格名称
    /// </summary>
    [SugarColumn(ColumnDescription = "规格名称", IsNullable = true)]
    public string PropertyName { get; set; }
    /// <summary>
    /// 规格编码
    /// </summary>
    [SugarColumn(ColumnDescription = "规格编码", IsNullable = true)]
    public string Code { get; set; }
    /// <summary>
    /// 预览图
    /// </summary>
    [SugarColumn(ColumnDescription = "规格图", IsNullable = true)]
    public string Image { get; set; }
    /// <summary>
    /// 价格
    /// </summary>
    [SugarColumn(ColumnDescription = "价格", DefaultValue = "0", DecimalDigits =2, IsNullable = true)]
    public decimal Price { get; set; }
    /// <summary>
    /// 成本价
    /// </summary>
    [SugarColumn(ColumnDescription = "成本价", DefaultValue = "0", DecimalDigits = 2, IsNullable = true)]
    public decimal Cost { get; set; }
    /// <summary>
    /// 总库存
    /// </summary>
    [SugarColumn(ColumnDescription = "库存", DefaultValue = "0", IsNullable = true)]
    public int Stock { get; set; }
}

public class TProductSkuSeedData : ISeedData<TProductSku>
{
    public IEnumerable<TProductSku> Generate()
        =>
        [
            new TProductSku() { Id = 1, ProductId=1, PropertyName="红色/水果", PropertyIds="4,8", Code="S20250827135434201-1", Image="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", Cost=2.50M, Price=9.99M, Stock=999 },
            new TProductSku() { Id = 1, ProductId=1, PropertyName="红色/可乐", PropertyIds="4,9", Code="S20250827135434202-2", Image="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", Cost=2.50M, Price=9.99M, Stock=999 },
            new TProductSku() { Id = 1, ProductId=1, PropertyName="绿色/水果", PropertyIds="5,8", Code="S20250827135434203-3", Image="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", Cost=2.50M, Price=9.99M, Stock=999 },
            new TProductSku() { Id = 1, ProductId=1, PropertyName="绿色/可乐", PropertyIds="5,9", Code="S20250827135434204-4", Image="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", Cost=2.50M, Price=9.99M, Stock=999 },
            new TProductSku() { Id = 1, ProductId=1, PropertyName="黄色/水果", PropertyIds="6,8", Code="S20250827135434205-5", Image="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", Cost=2.50M, Price=9.99M, Stock=999 },
            new TProductSku() { Id = 1, ProductId=1, PropertyName="黄色/可乐", PropertyIds="6,9", Code="S20250827135434206-6", Image="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", Cost=2.50M, Price=9.99M, Stock=999 },
        ];
}
